import api from "@/util/api";

//根据用户名查询用户
async function findByUsername(username) {
    try {
        let resp = await api({
            url: "/users/username",
            method: "GET",
            params: {
                username
            }
        });
        return resp;
    } catch (error) {
        console.log(error);
    }

    return false;
}

// 登录认证api
async function login(user) {
    try {
        let resp = await api({
            url: "/users/login",
            method: "POST",
            data: user
        });
        return resp;
    } catch (error) {
        console.log(error);
    }

    return false;
}

export { findByUsername, login }